import {
  Body,
  Controller,
  Post,
  UseGuards,
} from '@nestjs/common';
import {
  ApiBearerAuth,
  ApiOkResponse,
  ApiOperation,
  ApiTags,
} from '@nestjs/swagger';
import { FileService } from './file.service';
import { FileCreateUploadTokenDto } from '@/module/file/file.dto';
import { AdminAuthGuard } from "@/common/auth/admin-auth.guard";
import { FileCreateUploadTokenResult } from "@/module/file/file.result";

@Controller('/v1/admin/file')
@ApiTags('File_Admin')
@ApiBearerAuth()
@UseGuards(AdminAuthGuard)
export class FileV1AdminController {
  constructor(private readonly fileService: FileService) {
  }

  @Post('/upload-token')
  @ApiOperation({ summary: '全部' })
  @ApiOkResponse({ type: FileCreateUploadTokenResult })
  async createUploadToken(@Body() body: FileCreateUploadTokenDto): Promise<FileCreateUploadTokenResult> {
    const res = await this.fileService.createUploadToken(body);
    return res;
  }
}
